/*
 ============================================================================
 Name        : hev-main.c
 Author      : Heiher <admin@heiher.info>
 Version     : 0.0.2
 Copyright   : Copyright (c) 2010 everyone.
 Description : Linkage 802.1x for Unix-like operating system.
 ============================================================================
 */

#include <gtk/gtk.h>
#include <libnotify/notify.h>

#include "hev-main.h"
#include "hev-server.h"
#include "hev-main-dialog.h"

int main(int argc, char * argv[])
{
	GObject * server = NULL;
	GError * error = NULL;

	gtk_init(&argc, &argv);
	notify_init("hev-linkage-gtk");
	server = hev_server_new(NULL, &error);
	if(HEV_IS_SERVER(server))
	{
		GtkWidget * main_dialog = NULL;

		main_dialog = hev_main_dialog_new();
		if(HEV_IS_MAIN_DIALOG(main_dialog))
		{
			hev_main_dialog_set_server(HEV_MAIN_DIALOG(main_dialog), server);

			gtk_main();
		}

		g_object_unref(server);
	}
	else
	{
		g_critical("[%s -> hev_server_new]: %s", __FUNCTION__, error->message);
		g_error_free(error);
	}
	if(notify_is_initted())
	{
		notify_uninit();
	}

	return 0;
}
